Page({
  data: {
    city:'',
    text:'',
    temp:'',
    windDir:'',
    humidity:'',
    windScale:''
  },
  input(e){
    console.log(e)
    this.setData({
      city:e.detail.value
    })
  },
  here(){
    wx.getLocation({
      success:res => {
        let loc = res.longitude+','+res.latitude
        let url = 'https://devapi.qweather.com/v7/weather/now?key=c1e08190fafb4ed4a84363806b343feb&location='+loc
        wx.request({
          url,
          success:res => {
            let {text,temp,windDir,humidity,windScale} = res.data.now
            this.setData({
              text,temp,windDir,humidity,windScale
            })
          }
        })
      }
    })
  }
})